<template>
  <div class="common-layout">
    <el-container>
      <el-aside :width="isCollapse ? '0px' : '200px'" class="sidebar">
        <SideMenu :isCollapse="isCollapse" />
      </el-aside>
      <el-container>
        <el-header>
          <Header
            :isCollapse="isCollapse"
            @update:isCollapse="isCollapse = $event"
          />
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { ref } from "vue";
import SideMenu from "@/components/SideMenu.vue";
import Header from "@/components/Header.vue";

const isCollapse = ref(false);
</script>

<style scoped>
.el-header {
  background-color: #ffffff;
  color: #333;
  line-height: 60px;
  padding: 0;
}

.sidebar {
  background-color: #304156;
  transition: width 0.3s;
  position: relative;
}

.el-main {
  background-color: #f0f2f5;
  color: #333;
}

.common-layout {
  height: 100vh;
}

.el-container {
  height: 100%;
}
</style>
